package hn.sigit.view;

import hn.sigit.model.commons.IParcel;
import hn.sigit.model.commons.ISpatialZone;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("zoneInfoHelper")
@Scope(value=ScopeType.SESSION)
@AutoCreate
public class ZoneInfoHelper {
	private ISpatialZone spatialZone;

	
	public ISpatialZone getSpatialZone() {
		return spatialZone;
	}
	public void setSpatialZone(ISpatialZone spatialZone) {
		this.spatialZone = spatialZone;
	}
	
	public IParcel getParcel() {
		if (isParcelInstance())
			return (IParcel) spatialZone;
		return null;
	}
	
	public boolean isParcelInstance() {
		return spatialZone instanceof IParcel;
	}
}
